platform/api/app/Http/Controllers/RegistrationController.php
/**
     * @param Collection $sessions
     * @param CreatePayment $createPayment
     * @return array
     */
@param Collection $sessions
@param CreatePayment $createPayment
@return array
@param Collection $sessions @param CreatePayment $createPayment @return array
protected function mappedSessions(Collection $sessions, CreatePayment $createPayment): array
    {
        return $sessions->mapWithKeys(function ($session) use ($createPayment) {
            $item = new Item();
            $item->setName($session->title)
                ->setQuantity(1)
                ->setPrice($session->cost);
            $createPayment->addItem($item);
            return [
                $session->id => [
                    'cost' => $session->cost,
                ]
            ];
        })->toArray();
    }
protected function mappedSessions ( Collection $ sessions , CreatePayment $ createPayment ) : array { return $ sessions -> mapWithKeys ( function ( $ session ) use ( $ createPayment ) { $ item = new Item ( ) ; $ item -> setName ( $ session -> title ) -> setQuantity ( 1 ) -> setPrice ( $ session -> cost ) ; $ createPayment -> addItem ( $ item ) ; return [ $ session -> id => [ 'cost' => $ session -> cost , ] ] ; } ) -> toArray ( ) ; }
@param Collection $sessions
 @param CreatePayment $createPayment
 @return array
@param Collection $sessions @param CreatePayment $createPayment @return array