master

laravel/framework

Last updated at: 29/12/2023 09:25

Debugging.php

TLDR

The Debugging trait in the Debugging.php file provides methods for debugging and dumping variables.

Methods

dump

Dumps the given props. It accepts an optional string parameter $prop and returns the instance of the class.

prop

This is an abstract method that retrieves a prop within the current scope using "dot" notation. It accepts an optional string parameter $key and returns the corresponding value.

<?php

namespace Illuminate\Testing\Fluent\Concerns;

use Illuminate\Support\Traits\Dumpable;

trait Debugging
{
    use Dumpable;

    /**
     * Dumps the given props.
     *
     * @param  string|null  $prop
     * @return $this
     */
    public function dump(string $prop = null): self
    {
        dump($this->prop($prop));

        return $this;
    }

    /**
     * Retrieve a prop within the current scope using "dot" notation.
     *
     * @param  string|null  $key
     * @return mixed
     */
    abstract protected function prop(string $key = null);
}