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