Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Gets the class methods' names
<?php get_class_methods(object|string $object_or_class): array
<?php protected function getRelations($model)
{
return collect(get_class_methods($model))
->map(fn ($method) => new ReflectionMethod($model, $method))
->reject(
fn (ReflectionMethod $method) => $method->isStatic()
<?php protected static function getMutatorMethods($class)
{
preg_match_all('/(?<=^|;)get([^;]+?)Attribute(;|$)/', implode(';', get_class_methods($class)), $matches);
return $matches[1];
}
<?php private function hasHigherOrderCallable(): bool
{
return in_array($this->name, get_class_methods(HigherOrderCallables::class), true);
}
private function getUndefinedMethodMessage(object $target, string $methodName): string
<?php protected function registerCoreModifiers()
{
$modifiers = collect();
$methods = array_diff(get_class_methods(CoreModifiers::class), get_class_methods(Modifier::class));
foreach ($methods as $method) {
$modifiers[Str::snake($method)] = CoreModifiers::class.'@'.$method;
<?php protected function getNamesFromProvider(Base $provider)
{
return collect(get_class_methods($provider))
->reject(function(string $methodName) {
return Str::startsWith($methodName, '__');
})