method_exists

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Checks if the class method exists
<?php method_exists(object|string $object_or_class, string $method): bool
<?php     }



    function callBoot(...$params) {

        if (method_exists($this, 'boot')) $this->boot(...$params);

    }



    function callMount(...$params) {
<?php     }



    function callMount(...$params) {

        if (method_exists($this, 'mount')) $this->mount(...$params);

    }



    function callHydrate(...$params) {
<?php     }



    function callHydrate(...$params) {

        if (method_exists($this, 'hydrate')) $this->hydrate(...$params);

    }



    function callUpdate($propertyName, $fullPath, $newValue) {
<?php     function callUpdate($propertyName, $fullPath, $newValue) {

        $callbacks = [];



        if (method_exists($this, 'update')) $callbacks[] = $this->update($propertyName, $fullPath, $newValue);



        return function (...$params) use ($callbacks) {

            foreach ($callbacks as $callback) {
<?php     function callCall($method, $params, $returnEarly) {

        $callbacks = [];



        if (method_exists($this, 'call')) $callbacks[] = $this->call($method, $params, $returnEarly);



        return function (...$params) use ($callbacks) {

            foreach ($callbacks as $callback) {
<?php     function callRender(...$params) {

        $callbacks = [];



        if (method_exists($this, 'render')) $callbacks[] = $this->render(...$params);



        return function (...$params) use ($callbacks) {

            foreach ($callbacks as $callback) {
<?php     }



    function callDehydrate(...$params) {

        if (method_exists($this, 'dehydrate')) $this->dehydrate(...$params);

    }



    function callDestroy(...$params) {
<?php     }



    function callDestroy(...$params) {

        if (method_exists($this, 'destroy')) $this->destroy(...$params);

    }



    function callException(...$params) {
<?php     }



    function callException(...$params) {

        if (method_exists($this, 'exception')) $this->exception(...$params);

    }



    function getProperties()
<?php     static function register($hook)

    {

        if (method_exists($hook, 'provide')) $hook::provide();



        if (in_array($hook, static::$componentHooks)) return;
<?php         $hook->setComponent($target);




        if (method_exists($hook, 'skip') && $hook->skip()) {

            return;

        }
<?php             ->mapWithKeys(function ($property) use ($target) {



                if (method_exists($property, 'isInitialized') && !$property->isInitialized($target)) {



                    $value = (method_exists($property, 'getType') && $property->getType() && method_exists($property->getType(), 'getName') && $property->getType()->getName() === 'array')
<?php                 if (method_exists($property, 'isInitialized') && !$property->isInitialized($target)) {



                    $value = (method_exists($property, 'getType') && $property->getType() && method_exists($property->getType(), 'getName') && $property->getType()->getName() === 'array')

                        ? [] : null;

                } else {

                    $value = $property->getValue($target);
<?php     public function resolveMountParameters(Route $route, Component $component)

    {

        if (! method_exists($component, 'mount')) {

            return new Collection();

        }
<?php             ->getAttributes()

            ->whereInstanceOf(LivewireAttribute::class)

            ->each(function ($attribute) use ($params) {

                if (method_exists($attribute, 'boot')) {

                    $attribute->boot(...$params);

                }

            });