property_exists

Supported Versions: PHP 5 >= 5.1.0, PHP 7, PHP 8
Checks if the object or class has a property
<?php property_exists(object|string $object_or_class, string $property): bool
<?php {

    public function hasProperty($prop)

    {

        return property_exists($this, Utils::beforeFirstDot($prop));

    }



    public function getPropertyValue($name)
<?php     static public function hasProperty($target, $property)

    {

        return property_exists($target, static::beforeFirstDot($property));

    }



    static public function shareWithViews($name, $value)
<?php     public function hasProperty($prop)

    {

        return property_exists($this, Utils::beforeFirstDot($prop));

    }



    public function getPropertyValue($name)
<?php             return $this->component->paginationView();

        }



        return 'livewire::' . (property_exists($this->component, 'paginationTheme') ? invade($this->component)->paginationTheme : config('livewire.pagination_theme', 'tailwind'));

    }



    protected function paginationSimpleView()
<?php             return $this->component->paginationSimpleView();

        }



        return 'livewire::simple-' . (property_exists($this->component, 'paginationTheme') ? invade($this->component)->paginationTheme : config('livewire.pagination_theme', 'tailwind'));

    }



    protected function getQueryString()
<?php         $componentQueryString = [];



        if (method_exists($component, 'queryString')) $componentQueryString = invade($component)->queryString();

        elseif (property_exists($component, 'queryString')) $componentQueryString = invade($component)->queryString;



        return $this->queryString = collect(class_uses_recursive($class = $component::class))

            ->map(function ($trait) use ($class, $component) {
<?php                     return invade($component)->{$member}();

                }



                if (property_exists($class, $member)) {

                    return invade($component)->{$member};

                }
<?php         $rulesFromComponent = [];



        if (method_exists($this, 'rules')) $rulesFromComponent = $this->rules();

        else if (property_exists($this, 'rules')) $rulesFromComponent = $this->rules;



        $rulesFromOutside = array_merge_recursive(

            ...array_map(
<?php         $messages = [];



        if (method_exists($this, 'messages')) $messages = $this->messages();

        elseif (property_exists($this, 'messages')) $messages = $this->messages;



        $messagesFromOutside = array_merge(

            ...array_map(
<?php         $validationAttributes = [];



        if (method_exists($this, 'validationAttributes')) $validationAttributes = $this->validationAttributes();

        elseif (property_exists($this, 'validationAttributes')) $validationAttributes = $this->validationAttributes;



        $validationAttributesFromOutside = array_merge(

            ...array_map(
<?php     protected function getValidationCustomValues()

    {

        if (method_exists($this, 'validationCustomValues')) return $this->validationCustomValues();

        if (property_exists($this, 'validationCustomValues')) return $this->validationCustomValues;



        return [];

    }
<?php     protected function hydrateProperties($component, $data, $context)

    {

        foreach ($data as $key => $value) {

            if (! property_exists($component, $key)) continue;



            $child = $this->hydrate($value, $context, $key);
<?php         $childKey = str($path)->afterLast('.');



        if ($parent && is_object($parent) && property_exists($parent, $childKey) && Utils::propertyIsTyped($parent, $childKey)) {

            $type = Utils::getProperty($parent, $childKey)->getType();



            $types = $type instanceof ReflectionUnionType ? $type->getTypes() : [$type];
<?php     public static function getKey() {

        throw_unless(

            property_exists(static::class, 'key'),

            new \Exception('You need to define static $key property on: '.static::class)

        );
<?php     public function __construct($event)

    {

        $this->event = $event;

        $this->tries = property_exists($event, 'tries') ? $event->tries : null;

        $this->timeout = property_exists($event, 'timeout') ? $event->timeout : null;

        $this->backoff = property_exists($event, 'backoff') ? $event->backoff : null;

        $this->afterCommit = property_exists($event, 'afterCommit') ? $event->afterCommit : null;