\Drupflare\Anachron\Drupal\Extension LegacyInfoConverter

Turns a parsed Drupal 7 `.info` array into the `.info.yml` a current core reads.

The conversion is data only. A dependency on a core module Drupal 11 renamed is mapped, one on a core module it removed is dropped, and a version constraint on a dependency is cut because no extension here carries a Drupal 7 version. Everything dropped is returned beside the result, so a report can say what the conversion changed.

Summary

Methods
Properties
Constants
kind
convert
dependencyName
toYaml
No public properties found
RENAMED
REMOVED
No protected methods found
No protected properties found
No protected constants found
emit
scalar
No private properties found
KEPT

Constant

RENAMED

RENAMED = ['list' => 'options', 'menu' => 'menu_ui']

Drupal 7 core modules that Drupal 11 names differently.

REMOVED

REMOVED = ['blog', 'color', 'dashboard', 'field_sql_storage', 'number', 'openid', 'overlay', 'php', 'poll', 'profile', 'trigger']

Drupal 7 core modules with no Drupal 11 module of the same job.

KEPT

KEPT = ['name', 'description', 'package', 'version', 'project', 'configure', 'hidden', 'base theme', 'engine', 'regions', 'files']

Keys copied to the result as they are.

Methods

kind()

kind(array  $info, list  $extensions) : string

Decides whether an extension is a module, a theme or a profile.

Parameters

array $info

The parsed .info array.

list $extensions

The file extensions of the files beside the info file, such as module or profile.

Returns

string —

convert()

convert(array  $info, string  $type) : array{info: array<string,mixed>, dropped: list<string>}

Converts one parsed info array.

Parameters

array $info

The parsed .info array.

string $type

One of module, theme or profile.

Returns

array{info: array, dropped: list} —

The .info.yml content and the keys and dependencies the conversion removed.

dependencyName()

dependencyName(string  $dependency) : string

Cuts the version constraint off a dependency, so `views (>=3.0)` reads `views`.

Parameters

string $dependency

Returns

string —

toYaml()

toYaml(array  $info) : string

Writes an info array as YAML.

Parameters

array $info

Strings, booleans, integers and nested arrays of them.

Returns

string —

emit()

emit(array  $value, int  $depth) : string

Writes one level of an info array as YAML.

Parameters

array $value

The level to write.

int $depth

How many two-space indents the level sits at.

Returns

string —

scalar()

scalar(mixed  $value) : string

Writes a scalar as YAML: booleans and integers plain, everything else single quoted.

Parameters

mixed $value

Returns

string —