Creates cart using factory

@param ShopInterface        $shop
@param ClientInterface|null $client

@return CartInterface
19735
protected function createCart(ShopInterface $shop, ClientInterface $client = null)
    {
        $cart = $this->initResource();
        $cart->setShop($shop);
        $cart->setClient($client);

        $this->createResource($cart);

        return $cart;
    }
630070
public function create($type, $set, $sku, $productData, $storeView = null)
    {
        return $this->__createAction('catalog_product.create', func_get_args());
    }
864707
protected function updateCart(CartInterface $cart, ClientInterface $client = null, $currency)
    {
        $needsUpdate = false;

        if ($client !== $cart->getClient()) {
            $cart->setClient($client);
            $needsUpdate = true;
        }

        if ($currency !== $cart->getCurrency()) {
            $cart->setCurrency($currency);
            $needsUpdate = true;
        }

        if ($needsUpdate) {
            $this->updateResource($cart);
        }
    }
544733
public function createEmptyCart(CartCreateEvent $cartCreateEvent)
    {
        $cart = new CartModel();

        $cart->setCurrency($this->getSession()->getCurrency(true));

        /** @var CustomerModel $customer */
        if (null !== $customer = $this->getSession()->getCustomerUser()) {
            $cart->setCustomer(CustomerQuery::create()->findPk($customer->getId()));
        }

        $this->getSession()->setSessionCart($cart);

        if (ConfigQuery::read("cart.use_persistent_cookie", 1) == 1) {
            // set cart_use_cookie to "" to remove the cart cookie
            // see Thelia\Core\EventListener\ResponseListener
            $this->getSession()->set("cart_use_cookie", "");
        }

        $cartCreateEvent->setCart($cart);
    }
705096
public T build() {
        C clientObject = client;
        if (clientObject == null) {
            clientObject = createClient();
        }

        return factory.create(clientObject);
    }
217883
private function buildGuzzleSender(GuzzleClientInterface $client = null)
    {
        if (!$client) {
            if (!class_exists(GuzzleClient::class)) {
                throw new RuntimeException("You need to install 'guzzlehttp/guzzle' to use it as a sender");
            }

            $client = new GuzzleClient();
        }

        return new GuzzleSender($client);
    }
228765
public function createClient() {
        $this->client = $this->getKernel()->getContainer()->get('test.client');
        $client = $this->client;
        return $client;
    }
1289128
private function initializeClient($url, HttpClient $client = null)
    {
        if ($client) {
            return $this->client = $client;
        }

        return $this->client = $this->createDefaultHttpClient($url);
    }
689903
protected function createClientCredentialsClient(ClientRepository $clients)
    {
        $name = $this->option('name') ?: $this->ask(
            'What should we name the client?',
            config('app.name').' ClientCredentials Grant Client'
        );

        $client = $clients->create(
            null, $name, ''
        );

        $this->info('New client created successfully.');

        $this->outputClientDetails($client);
    }
443468
private function addClient(ClientInterface $client): self
    {
        $configurations = $this->configResolver->getParameter('configurations', 'ez_platform_automated_translation');
        $reflection     = new \ReflectionClass($client);
        $key            = strtolower($reflection->getShortName());
        if (isset($configurations[$key])) {
            $client->setConfiguration($configurations[$key]);
            $this->clients[$key] = $client;
        }

        return $this;
    }
560328
public static function asp(array $options = [], ClientInterface $client = null)
    {
        return Metrics\ASPs::all($options, $client);
    }
423537
public function setClient(\OAuth2\ServerBundle\Entity\Client $client = null)
    {
        $this->client = $client;

        return $this;
    }
651113
public static function setKey($key, ClientInterface $client = null)
	{
		self::$api = new Api($key, $client);

		return self::$api;
	}
380825
protected function duplicateCart(EventDispatcherInterface $dispatcher, CartModel $cart, CustomerModel $customer = null)
    {
        $newCart = $cart->duplicate(
            $this->generateCartCookieIdentifier(),
            $customer,
            $this->getSession()->getCurrency(),
            $dispatcher
        );

        $cartEvent = new CartDuplicationEvent($newCart, $cart);
        $dispatcher->dispatch(TheliaEvents::CART_DUPLICATE, $cartEvent);

        return $cartEvent->getDuplicatedCart();
    }
1195322
public static function make($account = null, $clientId = null, $clientSecret = null)
    {
        return new static($account, $clientId, $clientSecret);
    }
1064020
public function client($name = null)
    {
        if (is_null($name)) {
            $name = $this->getDefaultName();
        }

        if (! isset($this->clients[$name])) {
            $this->clients[$name] = new Client(
                $this->getWebhookForClient($name),
                $this->getMessageDefaultsForClient($name),
                $this->getHttpClientForClient($name)
            );
        }

        return $this->clients[$name];
    }
729509
public function addClient(\Gpupo\CommonSchema\ORM\Entity\Application\API\OAuth\Client\Client $client)
    {
        $this->clients[] = $client;

        return $this;
    }