public function data(string $slug = '', bool $by_slug = false)
    {
        if (!$slug) { // All data (i.e., for all slugs)?
            //
            if ($by_slug) { // All data keyed by slug?
                return $this->error_data ?: [$this->default_slug => null];
                //
            } else { // Data for the first slug.
                // NOTE: Different than `messages()`.
                $slug = $this->slug(); // First slug.
                return $this->error_data[$slug] ?? null;
            }
        } else {
            return $this->error_data[$slug] ?? null;
        }
    }
public function data(string $slug = '', bool $by_slug = false)
    {
        if (!$slug) { // All data (i.e., for all slugs)?
            //
            if ($by_slug) { // All data keyed by slug?
                return $this->error_data ?: [$this->default_slug => null];
                //
            } else { // Data for the first slug.
                // NOTE: Different than `messages()`.
                $slug = $this->slug(); // First slug.
                return $this->error_data[$slug] ?? null;
            }
        } else {
            return $this->error_data[$slug] ?? null;
        }
    }
public function data ( string $ slug = '' , bool $ by_slug = false ) { if ( ! $ slug ) { // All data (i.e., for all slugs)? // if ( $ by_slug ) { // All data keyed by slug? return $ this -> error_data ? : [ $ this -> default_slug => null ] ; // } else { // Data for the first slug. // NOTE: Different than `messages()`. $ slug = $ this -> slug ( ) ; // First slug. return $ this -> error_data [ $ slug ] ?? null ; } } else { return $ this -> error_data [ $ slug ] ?? null ; } }
Get error data.

@since 160710 Error utils.

@param string $slug    Error slug.
@param bool   $by_slug All data by slug?

@return array|mixed|null Error data.
Get error data .