Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

Commit

Permalink
Added a top level function to the machine class that allows a functio…
Browse files Browse the repository at this point in the history
…n to discover which function called it.
  • Loading branch information
nickbart committed Dec 24, 2012
1 parent 6910738 commit 4400dbb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Machine/MachineAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,21 @@ protected function makeCall($url)

return $this->xmlAttributesToArray($xml);
}

/**
* Universal function so any method belonging to a child class of a Plex
* machine can discover which fucntion called it. This is used mainly for
* some of our polymorphic requests as the calling function can tell us what
* type of item is being requested.
*
* @return string The name of the function that called the function that
* issued the getCallingFunction request.
*/
protected function getCallingFunction()
{
$backtrace = debug_backtrace();
// Index will always be 2 because 0 is this function and 1 will be the
// function that asked for the calling function.
return $backtrace[2]['function'];
}
}

0 comments on commit 4400dbb

Please sign in to comment.