Last active
June 3, 2021 07:58
-
-
Save evgeniy1204/ae374c5ada5c092b1079d8a828a9c497 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Avby\Domain\Advert\Enum; | |
final class AdvertTypeEnum | |
{ | |
public const CAR = 1; | |
public const MOTO = 2; | |
public const TRAILER = 3; | |
public const TRUCK = 4; | |
public const BUS = 5; | |
public const BOAT = 6; | |
public const SPEC = 7; | |
public const AGRO = 8; | |
public const TIRE = 9; | |
public const DISK = 10; | |
public const PARTS = 11; | |
/** | |
* @return int[] | |
*/ | |
public static function getAll(): array | |
{ | |
return [ | |
self::CAR, | |
self::MOTO, | |
self::TRAILER, | |
self::TRUCK, | |
self::BUS, | |
self::BOAT, | |
self::SPEC, | |
self::AGRO, | |
self::TIRE, | |
self::DISK, | |
self::PARTS, | |
]; | |
} | |
/** | |
* @return string[] | |
*/ | |
public static function getList(): array | |
{ | |
return [ | |
self::CAR => 'cars', | |
self::MOTO => 'moto', | |
self::TRAILER => 'trailer', | |
self::TRUCK => 'truck', | |
self::BUS => 'bus', | |
self::BOAT => 'boat', | |
self::SPEC => 'spec', | |
self::AGRO => 'agro', | |
self::TIRE => 'tires', | |
self::DISK => 'disk', | |
self::PARTS => 'parts', | |
]; | |
} | |
/** | |
* @param int $advertType | |
* @return bool | |
*/ | |
public static function isExist(int $advertType): bool | |
{ | |
return in_array($advertType, self::getAll(), true); | |
} | |
/** | |
* AdvertTypeEnum constructor. | |
*/ | |
private function __construct() | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment