Uploaded image for project: 'In-Portal CMS'
  1. In-Portal CMS
  2. INP-1462

Simplify "kEvent" class constructor

    XMLWordPrintable

    Details

    • Change Log Group:
      Changed
    • Change Log Message:
      The "kApplication::HandleEvent" method no longer supports event given in string form.
    • Story Points:
      1
    • Copy Issue Key:
    • Patch Instructions:

      Patches must be submitted through Phabricator.

    • BC Break Details:
      Hide

      Method Signature Changed:

      • kApplication::HandleEvent (removed optional "$params" and "$specific_params" parameters)
      • kEvent::__construct (replaced required "$params" parameter with required "$event_string" parameter)
      • kEvent::copyFrom (the "kEvent" type hint added to "$source_event" parameter)
      • kEvent::setRedirectParams (the "array" type hint added to "$params" parameter)

      Solution

      1. in "kApplication::HandleEvent" method:
        • add "$params" and "$specific_params" parameters back, but add "array" type hint to them
        • when "$params" parameter is an array, then
          • use "kUtil::deprecateParameter" method to trigger notice about usage of $params/$specific_params parameters
          • use "kEvent::fromArray" method to create event, that will replace "$event" parameter value
      2. extract logic, that transforms "$params" array into string from public static "kEvent::fromArray" into protected static "kEvent::arrayToString" method
      3. in "kEvent::__construct" method, when "$event_string" argument turns out to be an array:
        • use "kUtil::deprecateParameter" method to trigger notice about usage of $params parameter
        • use "kEvent::arrayToString" to transform "$event_string" parameter value
      Show
      Method Signature Changed: kApplication::HandleEvent (removed optional "$params" and "$specific_params" parameters) kEvent::__construct (replaced required "$params" parameter with required "$event_string" parameter) kEvent::copyFrom (the "kEvent" type hint added to "$source_event" parameter) kEvent::setRedirectParams (the "array" type hint added to "$params" parameter) Solution in "kApplication::HandleEvent" method: add "$params" and "$specific_params" parameters back, but add "array" type hint to them when "$params" parameter is an array, then use "kUtil::deprecateParameter" method to trigger notice about usage of $params/$specific_params parameters use "kEvent::fromArray" method to create event, that will replace "$event" parameter value extract logic, that transforms "$params" array into string from public static "kEvent::fromArray" into protected static "kEvent::arrayToString" method in "kEvent::__construct" method, when "$event_string" argument turns out to be an array: use "kUtil::deprecateParameter" method to trigger notice about usage of $params parameter use "kEvent::arrayToString" to transform "$event_string" parameter value

      Description

      Simplify "kEvent" class constructor by extracting array-like event creation way into separate static method.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alex Alex
                Reporter:
                alex Alex
                Developer:
                Alex
                Reviewer:
                Gleb Sinkovskiy [Intechnic]
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: