30 lines
773 B
PHP
Raw Normal View History

2017-01-30 22:10:14 -05:00
<?php
namespace BusinessLogic\Tickets;
use DataAccess\Tickets\TicketGateway;
2017-01-30 22:10:14 -05:00
class TicketValidators {
/**
* @var $ticketGateway TicketGateway
*/
private $ticketGateway;
function __construct($ticketGateway) {
$this->ticketGateway = $ticketGateway;
}
/**
* @param $customerEmail string The email address
* @param $heskSettings array HESK Settings
* @return bool true if the user is maxed out on open tickets, false otherwise
2017-01-30 22:10:14 -05:00
*/
function isCustomerAtMaxTickets($customerEmail, $heskSettings) {
if ($heskSettings['max_open'] === 0) {
return false;
}
2017-01-30 22:10:14 -05:00
return count($this->ticketGateway->getTicketsByEmail($customerEmail, $heskSettings)) >= $heskSettings['max_open'];
2017-01-30 22:10:14 -05:00
}
}