for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace WebTheory\Saveyour\Data;
use Psr\Http\Message\ServerRequestInterface;
use WebTheory\Saveyour\Contracts\Data\FieldDataManagerInterface;
class FieldDataManagerCallback implements FieldDataManagerInterface
{
/**
* @var callable
*/
private $getDataCallback;
private $handleDataCallback;
public function __construct(callable $getDataCallback, callable $handleDataCallback)
$this->getDataCallback = $getDataCallback;
$this->handleDataCallback = $handleDataCallback;
}
public function getCurrentData(ServerRequestInterface $request)
return ($this->getDataCallback)($request);
public function handleSubmittedData(ServerRequestInterface $request, $data): bool
return ($this->handleDataCallback)($request, $data);