VladimirCoder84
VladimirCoder84

Reputation: 185

Trace method object invocation php

I have a class to manage files and I use the method url () below

class Stored_File {


public $id;
public $extension;
public $mime;
public $filename;
public $source;

public function url()
{
    return static::url_from_filename($this->filename);
}

. . .

to have the path and use it. How can I check if the method url() for an instance has been called somewhere?I need to know if url is called because if not, means that the file is not used and I can delete it.

Upvotes: 0

Views: 84

Answers (1)

Matt Elliott
Matt Elliott

Reputation: 167

If this is just for debugging purposes, you could try inserting debug_backtrace() within your url() function to see where it is getting called from.

Checkout this link for some documentation about that method: http://php.net/manual/en/function.debug-backtrace.php

Upvotes: 1

Related Questions