| @@ 378-390 (lines=13) @@ | ||
| 375 | * |
|
| 376 | * @return string Full constant name |
|
| 377 | */ |
|
| 378 | protected function constantNameByValue($value, $className = Field::ENTITY) |
|
| 379 | { |
|
| 380 | // Get array where class constants are values and their values are keys |
|
| 381 | $nameByValue = array_flip((new \ReflectionClass($className))->getConstants()); |
|
| 382 | ||
| 383 | // Try to find constant by its value |
|
| 384 | if (null !== $nameByValue[$value]) { |
|
| 385 | // Return constant name |
|
| 386 | return $nameByValue[$value]; |
|
| 387 | } |
|
| 388 | ||
| 389 | return ''; |
|
| 390 | } |
|
| 391 | } |
|
| 392 | //[PHPCOMPRESSOR(remove,end)] |
|
| 393 | ||
| @@ 378-390 (lines=13) @@ | ||
| 375 | * |
|
| 376 | * @return string Full constant name |
|
| 377 | */ |
|
| 378 | protected function constantNameByValue($value, $className = Field::ENTITY) |
|
| 379 | { |
|
| 380 | // Get array where class constants are values and their values are keys |
|
| 381 | $nameByValue = array_flip((new \ReflectionClass($className))->getConstants()); |
|
| 382 | ||
| 383 | // Try to find constant by its value |
|
| 384 | if (null !== $nameByValue[$value]) { |
|
| 385 | // Return constant name |
|
| 386 | return $nameByValue[$value]; |
|
| 387 | } |
|
| 388 | ||
| 389 | return ''; |
|
| 390 | } |
|
| 391 | } |
|
| 392 | ||