\donbidon\CoreFriendlification

"Friendlification" functionality.

Summary

Methods
Properties
Constants
getConstNameByValue()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

getConstNameByValue()

getConstNameByValue(string  $class, mixed  $value) : string|false

Returns class const name by its value.

use donbidon\Core\Friendlification;

class Foo
{
    const ONE = 1;
    const TWO = 2;
}

var_dump(Friendlification::getConstNameByValue('Foo', 1));
var_dump(Friendlification::getConstNameByValue('Foo', 2));
var_dump(Friendlification::getConstNameByValue('Foo', 3));

will output:

string(3) "ONE"
string(3) "TWO"
bool(false)

Parameters

string $class
mixed $value

Throws

\ReflectionException

Risen from static::getReflection().

Returns

string|false