attributes->get('opcode'); $online_operators = get_online_operators(); if ( count($online_operators) == 0 ) { $is_online = "false"; } else if ( !empty($opcode) ) { $is_online = "false"; foreach ($online_operators as $item) { if ($item['code'] == $opcode) { $is_online = "true"; break; } } } $response = new Response($is_online); $response->headers->set('Access-Control-Allow-Origin', '*'); return $response; } }