sses with the stored data.
*/
protected function populate() {
$combined = $this->retrieve();
foreach ( $this->types as $key => $type ) {
if ( isset( $combined[ $key ] ) ) {
$type->merge( $combined[ $key ] );
}
}
}
/**
* Retrieve stored user favorites types.
*
* @return mixed|false
*/
protected function retrieve() {
return get_user_option( static::OPTION_NAME );
}
/**
* Update all changes to user favorites type.
*
* @return int|bool
*/
protected function store() {
return update_user_option( get_current_user_id(), static::OPTION_NAME, $this->combined() );
}
/**
* Throw action doesn't exist exception.
*
* @param string $action
*/
public function action_doesnt_exists( $action ) {
throw new \InvalidArgumentException( sprintf( esc_html(
"Action '%s' to apply on favorites doesn't exists",
$action
)) );
}
}