49 if ( !is_callable( $callable,
false, $this->callableName ) ) {
50 throw new InvalidArgumentException(
51 'Argument 1 passed to MemoizedCallable::__construct() must ' .
52 'be a callable; ' . get_debug_type( $callable ) .
' given'
56 if ( $callable instanceof Closure ) {
57 throw new InvalidArgumentException(
'Cannot memoize unnamed closure' );
60 if ( is_object( $callable ) || is_object( $callable[ 0 ] ) ) {
61 throw new InvalidArgumentException(
'Cannot memoize object-bound callable' );
64 $this->callable = $callable;
65 $this->ttl = min( max( $ttl, 1 ), 86400 );