Add generic NameValue class for name value pair collections
This commit is contained in:
parent
d0d0c04c5d
commit
196850f7b6
2 changed files with 20 additions and 15 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace App\Ramcar;
|
namespace App\Ramcar;
|
||||||
|
|
||||||
class JOStatus
|
class JOStatus extends NameValue
|
||||||
{
|
{
|
||||||
const PENDING = 'pending';
|
const PENDING = 'pending';
|
||||||
const RIDER_ASSIGN = 'rider_assign';
|
const RIDER_ASSIGN = 'rider_assign';
|
||||||
|
|
@ -19,18 +19,4 @@ class JOStatus
|
||||||
'cancelled' => 'Cancelled',
|
'cancelled' => 'Cancelled',
|
||||||
'fulfilled' => 'Fulfilled',
|
'fulfilled' => 'Fulfilled',
|
||||||
];
|
];
|
||||||
|
|
||||||
static public function getCollection()
|
|
||||||
{
|
|
||||||
return self::COLLECTION;
|
|
||||||
}
|
|
||||||
|
|
||||||
static public function validate($type_text)
|
|
||||||
{
|
|
||||||
if (isset(self::COLLECTION[$type_text]))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
19
src/Ramcar/NameValue.php
Normal file
19
src/Ramcar/NameValue.php
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Ramcar;
|
||||||
|
|
||||||
|
class NameValue
|
||||||
|
{
|
||||||
|
static public function getCollection()
|
||||||
|
{
|
||||||
|
return static::COLLECTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public function validate($type_text)
|
||||||
|
{
|
||||||
|
if (isset(static::COLLECTION[$type_text]))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue