private function listBasket(Basket $basket)
    {
        $ret = [
            'basket_id' => $basket->getId(),
            'owner' => $this->listUser($basket->getUser()),
            'created_on' => $basket->getCreated()->format(DATE_ATOM),
            'description' => (string) $basket->getDescription(),
            'name' => $basket->getName(),
            'pusher_usr_id'     => $basket->getPusher() ? $basket->getPusher()->getId() : null,
            'pusher'            => $basket->getPusher() ? $this->listUser($basket->getPusher()) : null,
            'updated_on'        => $basket->getUpdated()->format(DATE_ATOM),
            'unread'            => !$basket->isRead(),
            'validation_basket' => !!$basket->getValidation(),
        ];

        if ($basket->getValidation()) {
            $users = array_map(function (ValidationParticipant $participant) {
                $user = $participant->getUser();

                return [
                    'usr_id' => $user->getId(),
                    'usr_name' => $user->getDisplayName(),
                    'confirmed' => $participant->getIsConfirmed(),
                    'can_agree' => $participant->getCanAgree(),
                    'can_see_others' => $participant->getCanSeeOthers(),
                    'readonly' => $user->getId() != $this->getAuthenticatedUser()->getId(),
                    'user' => $this->listUser($user),
                ];
            }, iterator_to_array($basket->getValidation()->getParticipants()));

            $expires_on_atom = NullableDateTime::format($basket->getValidation()->getExpires());

            $ret = array_merge([
                'validation_users'          => $users,
                'expires_on'                => $expires_on_atom,
                'validation_infos'          => $basket->getValidation()
                    ->getValidationString($this->app, $this->getAuthenticatedUser()),
                'validation_confirmed'      => $basket->getValidation()
                    ->getParticipant($this->getAuthenticatedUser())
                    ->getIsConfirmed(),
                'validation_initiator'      => $basket->getValidation()
                    ->isInitiator($this->getAuthenticatedUser()),
                'validation_initiator_user' => $this->listUser($basket->getValidation()->getInitiator()),
            ], $ret);
        }

        return $ret;
    }
private function listBasket(Basket $basket)
    {
        $ret = [
            'basket_id' => $basket->getId(),
            'owner' => $this->listUser($basket->getUser()),
            'created_on' => $basket->getCreated()->format(DATE_ATOM),
            'description' => (string) $basket->getDescription(),
            'name' => $basket->getName(),
            'pusher_usr_id'     => $basket->getPusher() ? $basket->getPusher()->getId() : null,
            'pusher'            => $basket->getPusher() ? $this->listUser($basket->getPusher()) : null,
            'updated_on'        => $basket->getUpdated()->format(DATE_ATOM),
            'unread'            => !$basket->isRead(),
            'validation_basket' => !!$basket->getValidation(),
        ];

        if ($basket->getValidation()) {
            $users = array_map(function (ValidationParticipant $participant) {
                $user = $participant->getUser();

                return [
                    'usr_id' => $user->getId(),
                    'usr_name' => $user->getDisplayName(),
                    'confirmed' => $participant->getIsConfirmed(),
                    'can_agree' => $participant->getCanAgree(),
                    'can_see_others' => $participant->getCanSeeOthers(),
                    'readonly' => $user->getId() != $this->getAuthenticatedUser()->getId(),
                    'user' => $this->listUser($user),
                ];
            }, iterator_to_array($basket->getValidation()->getParticipants()));

            $expires_on_atom = NullableDateTime::format($basket->getValidation()->getExpires());

            $ret = array_merge([
                'validation_users'          => $users,
                'expires_on'                => $expires_on_atom,
                'validation_infos'          => $basket->getValidation()
                    ->getValidationString($this->app, $this->getAuthenticatedUser()),
                'validation_confirmed'      => $basket->getValidation()
                    ->getParticipant($this->getAuthenticatedUser())
                    ->getIsConfirmed(),
                'validation_initiator'      => $basket->getValidation()
                    ->isInitiator($this->getAuthenticatedUser()),
                'validation_initiator_user' => $this->listUser($basket->getValidation()->getInitiator()),
            ], $ret);
        }

        return $ret;
    }
private function listBasket ( Basket $ basket ) { $ ret = [ 'basket_id' => $ basket -> getId ( ) , 'owner' => $ this -> listUser ( $ basket -> getUser ( ) ) , 'created_on' => $ basket -> getCreated ( ) -> format ( DATE_ATOM ) , 'description' => ( string ) $ basket -> getDescription ( ) , 'name' => $ basket -> getName ( ) , 'pusher_usr_id' => $ basket -> getPusher ( ) ? $ basket -> getPusher ( ) -> getId ( ) : null , 'pusher' => $ basket -> getPusher ( ) ? $ this -> listUser ( $ basket -> getPusher ( ) ) : null , 'updated_on' => $ basket -> getUpdated ( ) -> format ( DATE_ATOM ) , 'unread' => ! $ basket -> isRead ( ) , 'validation_basket' => ! ! $ basket -> getValidation ( ) , ] ; if ( $ basket -> getValidation ( ) ) { $ users = array_map ( function ( ValidationParticipant $ participant ) { $ user = $ participant -> getUser ( ) ; return [ 'usr_id' => $ user -> getId ( ) , 'usr_name' => $ user -> getDisplayName ( ) , 'confirmed' => $ participant -> getIsConfirmed ( ) , 'can_agree' => $ participant -> getCanAgree ( ) , 'can_see_others' => $ participant -> getCanSeeOthers ( ) , 'readonly' => $ user -> getId ( ) != $ this -> getAuthenticatedUser ( ) -> getId ( ) , 'user' => $ this -> listUser ( $ user ) , ] ; } , iterator_to_array ( $ basket -> getValidation ( ) -> getParticipants ( ) ) ) ; $ expires_on_atom = NullableDateTime :: format ( $ basket -> getValidation ( ) -> getExpires ( ) ) ; $ ret = array_merge ( [ 'validation_users' => $ users , 'expires_on' => $ expires_on_atom , 'validation_infos' => $ basket -> getValidation ( ) -> getValidationString ( $ this -> app , $ this -> getAuthenticatedUser ( ) ) , 'validation_confirmed' => $ basket -> getValidation ( ) -> getParticipant ( $ this -> getAuthenticatedUser ( ) ) -> getIsConfirmed ( ) , 'validation_initiator' => $ basket -> getValidation ( ) -> isInitiator ( $ this -> getAuthenticatedUser ( ) ) , 'validation_initiator_user' => $ this -> listUser ( $ basket -> getValidation ( ) -> getInitiator ( ) ) , ] , $ ret ) ; } return $ ret ; }
Retrieve information about one basket

@param  Basket $basket

@return array
Retrieve information about one basket