Review 11.5 Merged

76945[TASK] Introduce string fragment extraction

Oliver Hader CR +2 V +2 Hard +573 −0 updated 12/07/22, 13:30

Commit message

When working with variable interpolation and similar scenarios, in
most cases variables, constants, expressions, ... are embedded in
a solid string and can only be identified and extracted by the
corresponding "reader" or "parser".

This string fragment splitter aims to introduce a simpler way for
extracting and working with these embedded fragments.

Example:
    $pattern = new StringFragmentPattern(
      StringFragmentSplitter::TYPE_EXPRESSION,
      '%[^%]+%'
    );
    $splitter = new StringFragmentSplitter($pattern);
    $collection = $splitter->split(
      'Hello %variable% World!'
      FLAG_UNMATCHED_AS_NULL
    );

    // results in having
    // + StringFragment(type: 'raw', value: 'Hello ')
    // + StringFragment(type: 'expression', value: '%variable%')
    // + StringFragment(type: 'raw', value: ' World!')

Review

  • Code review CR +2 Done
    • Oliver Hader +2
  • Verified V +2 Done
    • Oliver Hader +2
    • core-ci +1 CI

Issues 1

Files 6

Review log 34

  1. Oliver Hader uploaded patch set 1 12/07/22, 13:02

  2. core-ci voted on patch set 1 V +1 12/07/22, 13:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/34752

  3. Oliver Hader voted on patch set 1 V +2 CR +2 12/07/22, 13:28

  4. Oliver Hader merged patch set 2 12/07/22, 13:30