File: /var/www/html/wp-content/plugins/bsx/inc/collector.php
<?php
function cc($id) {
$cd = [];
$cd['id'] = $id;
$kpis = getKpis($id);
$cd['kpis'] = $kpis;
$cntr = get_field("contract",$id)[0];
$cntr_id = $cntr->ID;
$cass = get_field("cassandra",$id)[0];
$cass_id = $cass->ID;
$comp = get_field("company",$id)[0];
$comp_id = $comp->ID;
$cd = array_merge($cd,['cntr'=>$cntr,'cntr_id'=>$cntr_id,
'cass'=>$cass,'cass_id'=>$cass_id,
'comp'=>$comp,'comp_id'=>$comp_id]);
$ysym = get_field("ysym", $cntr_id);
$fx = get_field("currency", $cntr_id);
$corp = get_field('legal_name',$comp_id);
$cs_name = get_field('company_name',$cass_id);
$exch2 = get_field("exch2", $cntr_id);
$symbol2 = get_field("symbol2", $cntr_id);
$sym = $exch2 ? $exch2 . ": " . $symbol2 : $symbol2;
$a = new DateTimeImmutable($kpis->edt, new DateTimeZone('GMT'));
$b = new DateTimeImmutable(date('Y-m-d H:i:s'), new DateTimeZone('GMT'));
$dif = $b->diff($a);
$cd = array_merge($cd, ['ysym'=>$ysym,'fx'=>$fx,'corp'=>$corp,'cs_name'=>$cs_name,
'dif'=>$dif,'exch2'=>$exch2,'symbol2'=>$symbol2,'sym'=>$sym]);
return $cd;
}