src/EventPayload.php
/**
     * Higher order function that converts attribute values to either values or associative arrays.
     *
     * @return callable
     */
Higher order function that converts attribute values to either values or associative arrays.
@return callable
Higher order function that converts attribute values to either values or associative arrays . @return callable
private function transformToPayload(): callable
    {
        return function ($value) {
            if ($value instanceof EventPayloadInterface) {
                return $value->toPayload();
            }
            if (is_array($value)) {
                return map(array_values($value), $this->transformToPayload());
            }
            if (is_object($value) === true) {
                $message = 'Invalid object attribute found, toPayload() can only transform objects that implement ' .
                    EventPayloadInterface::class .
                    '.';
                throw new \Exception($message);
            }
            return $value;
        };
    }
private function transformToPayload ( ) : callable { return function ( $ value ) { if ( $ value instanceof EventPayloadInterface ) { return $ value -> toPayload ( ) ; } if ( is_array ( $ value ) ) { return map ( array_values ( $ value ) , $ this -> transformToPayload ( ) ) ; } if ( is_object ( $ value ) === true ) { $ message = 'Invalid object attribute found, toPayload() can only transform objects that implement ' . EventPayloadInterface :: class . '.' ; throw new \ Exception ( $ message ) ; } return $ value ; } ; }
Higher order function that converts attribute values to either values or associative arrays.
Higher order function that converts attribute values to either values or associative arrays .