36 lines
919 B
PHP
36 lines
919 B
PHP
<?php
|
|
|
|
namespace App\Service;
|
|
|
|
use App\Ramcar\WarrantyClass;
|
|
|
|
class WarrantyRaffleFilter
|
|
{
|
|
public function isValidRaffleEntry($entry)
|
|
{
|
|
// entry is an associative array
|
|
// Serial Number of Battery (NOT blank)
|
|
if (empty($entry['serial']))
|
|
return false;
|
|
|
|
// Plate Number (NOT blank)
|
|
if (empty($entry['plate_number']))
|
|
return false;
|
|
|
|
// Warranty Class (ONLY private)
|
|
if ($entry['warranty_class'] != WarrantyClass::WTY_PRIVATE)
|
|
return false;
|
|
|
|
// either contact number of mobile number is present
|
|
if ((empty($entry['contact_number'])) &&
|
|
(empty($entry['mobile_number'])))
|
|
return false;
|
|
|
|
// First Name & Last Name have to be present
|
|
if ((empty($entry['first_name'])) ||
|
|
(empty($entry['last_name'])))
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
}
|