/** * {@inheritdoc} */ public function __invoke($document, AccessFacade $access) { if (!$access->isWritable($document, $this->path)) { throw new OperationException(sprintf('The path "%s" does not exist.', (string) $this->path)); } $access->set($document, $this->path, $this->value); return $document; }
/** * @dataProvider isWritableDataProvider * * @param mixed $expected * @param array $document * @param string $path */ public function testIsWritable($expected, $document, $path) { $result = $this->facade->isWritable($document, new JsonPointer($path)); $this->assertEquals($expected, $result); }