for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Component\Core\Customer\Statistics;
use Sylius\Component\Core\Model\ChannelInterface;
use Webmozart\Assert\Assert;
/**
* @author Jan Góralski <[email protected]>
final class PerChannelCustomerStatistics
{
* @var int
private $ordersCount;
private $ordersValue;
* @var ChannelInterface
private $channel;
* @param int $ordersCount
* @param int $ordersValue
* @param ChannelInterface $channel
* @throws \InvalidArgumentException
public function __construct($ordersCount, $ordersValue, ChannelInterface $channel)
Assert::allInteger([$ordersCount, $ordersValue]);
$this->ordersCount = $ordersCount;
$this->ordersValue = $ordersValue;
$this->channel = $channel;
}
* @return int
public function getOrdersCount()
return $this->ordersCount;
public function getOrdersValue()
return $this->ordersValue;
* @return ChannelInterface
public function getChannel()
return $this->channel;
public function getAverageOrderValue()
return (int) round($this->ordersValue / $this->ordersCount);