ize_values( $items ); } /** * Unserialize item values. * * @param array $items Events from the Queue to be serialized. * * @return mixed */ private function unserialize_values( $items ) { array_walk( $items, function ( $item ) { $item->value = maybe_unserialize( $item->value ); } ); return $items; } /** * Return true if the buffer is still valid or an Error other wise. * * @param Automattic\Jetpack\Sync\Queue_Buffer $buffer The Queue_Buffer. * * @return bool|\WP_Error */ private function validate_checkout( $buffer ) { if ( ! $buffer instanceof Queue_Buffer ) { return new \WP_Error( 'not_a_buffer', 'You must checkin an instance of Automattic\\Jetpack\\Sync\\Queue_Buffer' ); } $checkout_id = $this->get_checkout_id(); if ( ! $checkout_id ) { return new \WP_Error( 'buffer_not_checked_out', 'There are no checked out buffers' ); } // TODO: change to strict comparison. if ( $checkout_id != $buffer->id ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison return new \WP_Error( 'buffer_mismatch', 'The buffer you checked in was not checked out' ); } return true; } }