$actor){$user=$profiles['profiles'][$key]['user_id'];$bindings[implode(':',array_values($f['scope'])).':'.$user]=array_replace($template,['actor_id'=>$actor,'warehouse_ids'=>[$nf['warehouse'],$ledger['warehouse_id']]]);} // Additional Stock warehouse is an explicit approved supplement, not a mutation of purchasing bindings. $stockMap=['composition'=>$tag,'warehouse_bindings'=>[implode(':',array_values($f['scope'])).':'.$f['validator']=>[$nf['warehouse'],$ledger['warehouse_id']]]]; $paths=['single-bindings.json'=>['composition'=>$tag,'bindings'=>$bindings],'stock-operations-binding.json'=>$stockMap];$pins=[]; foreach($paths as $file=>$data){$target=$s['root'].'/'.$file;$raw=json_encode($data,JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR);if(is_file($target)&&file_get_contents($target)!==$raw)throw new LogicException('Preserve differing private binding: '.$file);file_put_contents($target,$raw);$pins[$file]=hash_file('sha256',$target);} file_put_contents($s['root'].'/single-binding-pins.json',json_encode($pins,JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));echo json_encode(['passed'=>true,'book'=>$book,'new_profiles'=>count($bindings),'original_bindings_unchanged'=>true]).PHP_EOL;