57 parent::__construct(
$type, $key );
58 foreach ( [
'doWork',
'doCachedWork',
'fallback',
'error' ] as $name ) {
59 if ( isset( $callbacks[$name] ) ) {
60 if ( !is_callable( $callbacks[$name] ) ) {
61 throw new InvalidArgumentException(
"Invalid callback provided for '$name' function." );
63 $this->$name = $callbacks[$name];
66 if ( !isset( $this->
doWork ) ) {
67 throw new InvalidArgumentException(
"No callback provided for 'doWork' function." );
69 $this->cacheable = isset( $this->doCachedWork );