1<?php 2 3final class PhutilInvalidStateException extends Exception { 4 private $callee; 5 private $function; 6 7 public function __construct($function, $callee = null) { 8 if ($callee === null) { 9 $callee = idx(debug_backtrace(), 1); 10 $callee = idx($callee, 'function'); 11 } 12 13 $this->callee = $callee; 14 $this->function = $function; 15 16 parent::__construct( 17 pht( 18 'Call %s before calling %s!', 19 $this->function.'()', 20 $this->callee.'()')); 21 } 22 23 public function getCallee() { 24 return $this->callee; 25 } 26 27 public function getFunction() { 28 return $this->function; 29 } 30} 31