53 parent::__construct(
$type, $key );
54 foreach ( [
'doWork',
'doCachedWork',
'fallback',
'error' ] as $name ) {
55 if ( isset( $callbacks[$name] ) ) {
56 if ( !is_callable( $callbacks[$name] ) ) {
57 throw new InvalidArgumentException(
"Invalid callback provided for '$name' function." );
59 $this->$name = $callbacks[$name];
62 if ( !isset( $this->
doWork ) ) {
63 throw new InvalidArgumentException(
"No callback provided for 'doWork' function." );
65 $this->cacheable = isset( $this->doCachedWork );